﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlClient;
using DALayer;

namespace BALayer
{
    public class DBDonViToChuc
    {
        DAL db = null;
        public DBDonViToChuc()
        {
            db = new DAL();
        }
        public DataSet LayDonViToChuc()
        {
            return db.ExecuteQueryDataSet("select * from DonViToChuc", CommandType.Text, null);
        }
        public bool SuaDonViToChuc(ref string err, string MaDVTC, string TenDonVi)
        {
            return db.MyExecuteNonQuery("SuaDonViToChuc",
                CommandType.StoredProcedure, ref err,
                new SqlParameter("@MaDVTC", MaDVTC),
                new SqlParameter("@TenDonVi", TenDonVi));
        }
        public bool ThemDonViToChuc(ref string err, string MaDVTC, string TenDonVi)
        {
            return db.MyExecuteNonQuery("ThemDonViToChuc",
                CommandType.StoredProcedure, ref err,
                new SqlParameter("@MaDVTC", MaDVTC),
                new SqlParameter("@TenDonVi", TenDonVi));
        }
        public bool XoaDonViToChuc(ref string err, string MaDVTC)
        {
            return db.MyExecuteNonQuery("XoaDonViToChuc",
                CommandType.StoredProcedure, ref err,
                new SqlParameter("@MaDVTC", MaDVTC));
        }
    }
}

